<?php 

$sSql="Select count(*) as cnt from portal_comment where workflow_statusId=2 and contentId=".$contentId;
$rscomment=$GLOBALS["conn"]->Execute($sSql);
$count=$rscomment->fields["cnt"];
$onclick="";
if ($count>0) $onclick="loadComments('".$portletUID."',".$contentId.")";
?>
<a  id="getcommentsButton_<?php echo $portletUID; ?><?php echo $contentId; ?>" onclick="<?php echo $onclick; ?>"><img src="/images/comment.png" title="<?php echo $PortletText_comments; ?> (<?php echo $count; ?>)"></a>